A mobile user device (or “user device”) such as a smartphone, tablet, or wearable device may be equipped with a compass. The compass can calculate and provide its user with a direction, which may be a “heading” (typically given relative to the Earth's magnetic field), and/or an arrow pointing to true north. A navigation/map application running on the device may use the compass to display the user's heading and/or to calculate navigation instructions. For example, a mobile device may run a navigation/mapping application that receives, as input from the user, a destination location and provides turn-by-turn driving instructions to the user. To correctly calculate the next driving instruction, a user device needs to know the forward direction of the vehicle (referred to herein as the “vehicle orientation”) among other information. Existing devices/applications may rely on compass heading to determine vehicle orientation.
A compass can obtain a measure of the magnetic field that is present in its immediate surrounding as a three-component (e.g., in x, y, and z directions) vector, using a 3-axis magnetic sensor called a magnetometer. The sensed field contains a contribution by the Earth's magnetic field, and a contribution by a local interference field. The latter is the magnetic field that is created by components in the local environment of the mobile device, and can include hard and soft iron components. Hard iron refers to magnetic materials that are difficult to magnetize, but once magnetized will retain the magnetism for long periods of time. Soft iron refers to metals that are easily magnetized, but lose their magnetic state once the magnetizing force is removed. These local magnetic effects may include contributions by any magnetic component that is near the sensor, such as a loudspeaker that is built into the device. The interference field may also have a contribution due to magnetic elements found in the external environment close to the device, such as when the user is driving an automobile, riding in a train or bus, or riding on a bicycle or motorcycle.
In addition to a magnetometer, a user device may include various other motion sensors such as an accelerometer and gyroscope, along with a Global Positioning Satellite (GPS) receiver or similar location sensor.